package com.ruoyi.core.entity;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class PageInfo<T> {
    /**
     * 当前页
     */
    protected int pageNum;
    /**
     * 每页的数量
     */
    protected int pageSize;
    /**
     * 排序字段
     */
    protected String sortName;
    /**
     * 排序方式
     */
    protected String sortBy;
    /**
     * 结果集
     */
    protected List<T> list;
    /**
     * 总记录数
     */
    protected int total;
    /**
     * 当前页的数量
     */
    protected int size;
    /**
     * 总页数
     */
    protected int pages;
    /**
     * 合计行
     */
    protected BaseMap summary;

    public PageInfo() {
        this.pageNum = 1;
        this.pageSize = 10;
        this.list = new ArrayList<>();
    }

    public PageInfo(int pageNum, int pageSize) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.list = new ArrayList<>();
    }

    public PageInfo(int pageNum, int pageSize, List<T> list, int total) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.list = list == null ? new ArrayList<>() : list;
        this.total = total;
    }
}
